
#ifndef __CE_GFX_GL20_RENDERTARGETFBO_H__
#define __CE_GFX_GL20_RENDERTARGETFBO_H__

#include <gfx/irendertarget.h>
#include <gfx/gl20/device.h>
#include <GL/glew.h>

/**
 * \addtogroup opengl
 * @{
 */

/**
 * @brief OpenGL 2.0 implemenation of the iRenderTarget interface.
 */
class ceRenderTargetFBO : public iRenderTarget
{
  CE_OBJECT
private:
  GLuint      _fboName;

  GLuint      _depthStencilRenderbuffer;
  iTexture2D* _colorTexture;
  iTexture2D* _depthTexture;

  ceRect  _size;

public:
  ceRenderTargetFBO();

  bool Initialize (iDevice* device, const ceRenderTargetDescriptor& desc);

  void Bind ();
  void Unbind ();

  const ceRect& GetSize () const;

  int GetX () const;
  int GetY () const;

  unsigned GetWidth () const;
  unsigned GetHeight () const;


  ceRenderTargetMethod GetMethod () const;

  iTexture2D* GetColorTexture() const;

  iTexture2D* GetDepthTexture() const;

};

/** @} */
#endif /* !__CE_GFX_GL20_RENDERTARGETFBO_H__ */
